using System;
using System.Collections;
using System.ComponentModel;
using System.Runtime.Serialization;
namespace Net35.Xrm.Sdk.Query
{
	[DataContract(Name = "ConditionExpression", Namespace = "http://schemas.microsoft.com/xrm/2011/Contracts")]
	public sealed class ConditionExpression : IExtensibleDataObject
	{
		private string _attributeName;
		private ConditionOperator _conditionOperator;
		private DataCollection<object> _values;
		private string _entityName;
		private ExtensionDataObject _extensionDataObject;
		[DataMember(Order = 60)]
		public string EntityName
		{
			get
			{
				return this._entityName;
			}
			set
			{
				this._entityName = value;
			}
		}
		[DataMember]
		public string AttributeName
		{
			get
			{
				return this._attributeName;
			}
			set
			{
				this._attributeName = value;
			}
		}
		[DataMember]
		public ConditionOperator Operator
		{
			get
			{
				return this._conditionOperator;
			}
			set
			{
				this._conditionOperator = value;
			}
		}
		[DataMember]
		public DataCollection<object> Values
		{
			get
			{
				if (this._values == null)
				{
					this._values = new DataCollection<object>();
				}
				return this._values;
			}
			private set
			{
				this._values = value;
			}
		}
		public ExtensionDataObject ExtensionData
		{
			get
			{
				return this._extensionDataObject;
			}
			set
			{
				this._extensionDataObject = value;
			}
		}
		public ConditionExpression()
		{
		}
		public ConditionExpression(string attributeName, ConditionOperator conditionOperator, params object[] values) : this(null, attributeName, conditionOperator, values)
		{
		}
		public ConditionExpression(string entityName, string attributeName, ConditionOperator conditionOperator, params object[] values)
		{
			this._entityName = entityName;
			this._attributeName = attributeName;
			this._conditionOperator = conditionOperator;
			if (values != null)
			{
				this._values = new DataCollection<object>(values);
			}
		}
		public ConditionExpression(string attributeName, ConditionOperator conditionOperator, object value) : this(attributeName, conditionOperator, new object[]
		{
			value
		})
		{
		}
		public ConditionExpression(string entityName, string attributeName, ConditionOperator conditionOperator, object value) : this(entityName, attributeName, conditionOperator, new object[]
		{
			value
		})
		{
		}
		public ConditionExpression(string attributeName, ConditionOperator conditionOperator) : this(null, attributeName, conditionOperator, new object[0])
		{
		}
		public ConditionExpression(string entityName, string attributeName, ConditionOperator conditionOperator) : this(entityName, attributeName, conditionOperator, new object[0])
		{
		}
		public ConditionExpression(string attributeName, ConditionOperator conditionOperator, ICollection values)
		{
			this._attributeName = attributeName;
			this._conditionOperator = conditionOperator;
			if (values != null)
			{
				this._values = new DataCollection<object>();
				foreach (object current in values)
				{
					this._values.Add(current);
				}
			}
		}
		[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
		internal void Accept(IQueryVisitor visitor)
		{
			visitor.Visit(this);
		}
	}
}
